piggyback Qt codec on to cet_convert_init.
authortsteven4 <tsteven4@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 21 Sep 2014 23:01:51 +0000 (23:01 +0000)
committertsteven4 <tsteven4@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 21 Sep 2014 23:01:51 +0000 (23:01 +0000)
fix encoding in garmin gpi reader and writer using piggybacked global codec.
utilized piggybacked global codec in naviguide reader and writer.

14 files changed:
gpsbabel/cet/iso_8859_8.h [new file with mode: 0644]
gpsbabel/cet_util.cc
gpsbabel/defs.h
gpsbabel/garmin_gpi.cc
gpsbabel/internal_styles.cc
gpsbabel/naviguide.cc
gpsbabel/reference/garmin_gpi_encoding.gpi [new file with mode: 0644]
gpsbabel/reference/garmin_gpi_encoding.gpx [new file with mode: 0644]
gpsbabel/reference/garmin_gpi_encoding2.gpi.gpx [new file with mode: 0644]
gpsbabel/style/igo2008_poi.style
gpsbabel/style/tomtom_asc.style
gpsbabel/style/tomtom_itn.style
gpsbabel/style/tomtom_itn_places.style
gpsbabel/testo.d/garmin_gpi.test

diff --git a/gpsbabel/cet/iso_8859_8.h b/gpsbabel/cet/iso_8859_8.h
new file mode 100644 (file)
index 0000000..e22f04a
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+
+    Data automatically generated from recode output:
+
+        'recode -lf "ISO-8859-8" 2>/dev/null'
+
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+*/
+
+#ifndef iso_8859_8_h
+#define iso_8859_8_h
+
+#define cet_cs_name_iso_8859_8 "ISO-8859-8"
+
+const char *cet_cs_alias_iso_8859_8[] = 
+{
+       "ISO-8859-8", "csISOLatinHebrew", "hebrew", "ISO8859-8", 
+       "iso-ir-138", "ISO_8859-8", "ISO_8859-8:1988", NULL
+};
+
+#define cet_ucs4_ofs_iso_8859_8 161
+#define cet_ucs4_cnt_iso_8859_8 90
+
+const int cet_ucs4_map_iso_8859_8[cet_ucs4_cnt_iso_8859_8] =
+{
+           -1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 0x00a8, 
+       0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x203e, 0x00b0, 
+       0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 
+       0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be,     -1,     -1, 
+           -1,     -1,     -1,     -1,     -1,     -1,     -1,     -1, 
+           -1,     -1,     -1,     -1,     -1,     -1,     -1,     -1, 
+           -1,     -1,     -1,     -1,     -1,     -1,     -1,     -1, 
+           -1,     -1,     -1,     -1,     -1,     -1, 0x2017, 0x05d0, 
+       0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, 0x05d8, 
+       0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, 0x05e0, 
+       0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, 0x05e8, 
+       0x05e9, 0x05ea
+};
+
+#define cet_ucs4_to_iso_8859_8_ct 31
+
+const cet_ucs4_link_t cet_ucs4_to_iso_8859_8_links[cet_ucs4_to_iso_8859_8_ct] =
+{
+        {0x00d7, 0xaa} /* sign */,
+        {0x00f7, 0xba} /* sign */,
+        {0x05d0, 0xe0} /* letter alef */,
+        {0x05d1, 0xe1} /* letter bet */,
+        {0x05d2, 0xe2} /* letter gimel */,
+        {0x05d3, 0xe3} /* letter dalet */,
+        {0x05d4, 0xe4} /* letter he */,
+        {0x05d5, 0xe5} /* letter vav */,
+        {0x05d6, 0xe6} /* letter zayin */,
+        {0x05d7, 0xe7} /* letter het */,
+        {0x05d8, 0xe8} /* letter tet */,
+        {0x05d9, 0xe9} /* letter yod */,
+        {0x05da, 0xea} /* letter final kaf */,
+        {0x05db, 0xeb} /* letter kaf */,
+        {0x05dc, 0xec} /* letter lamed */,
+        {0x05dd, 0xed} /* letter final mem */,
+        {0x05de, 0xee} /* letter mem */,
+        {0x05df, 0xef} /* letter final nun */,
+        {0x05e0, 0xf0} /* letter nun */,
+        {0x05e1, 0xf1} /* letter samekh */,
+        {0x05e2, 0xf2} /* letter ayin */,
+        {0x05e3, 0xf3} /* letter final pe */,
+        {0x05e4, 0xf4} /* letter pe */,
+        {0x05e5, 0xf5} /* letter final tsadi */,
+        {0x05e6, 0xf6} /* letter tsadi */,
+        {0x05e7, 0xf7} /* letter qof */,
+        {0x05e8, 0xf8} /* letter resh */,
+        {0x05e9, 0xf9} /* letter shin */,
+        {0x05ea, 0xfa} /* letter tav */,
+        {0x2017, 0xdf} /* low line */,
+        {0x203e, 0xaf} /* overline */
+};
+
+/*
+#define cet_ucs4_to_iso_8859_8_extra_ct 0
+const cet_ucs4_link_t cet_ucs4_to_iso_8859_8_extra[cet_ucs4_to_iso_8859_8_extra_ct] = {};
+*/
+
+cet_cs_vec_t cet_cs_vec_iso_8859_8 =   /* defined in cet.h */
+{      
+       cet_cs_name_iso_8859_8,         /* name of character set        */
+       cet_cs_alias_iso_8859_8,                /* alias table                  */
+
+       NULL,                           /* ... to UCS-4 converter (multi-byte) */
+       NULL,                           /* UCS-4 to ... converter (multi-byte) */
+
+       cet_ucs4_map_iso_8859_8,                /* char to UCS-4 value table    */
+       cet_ucs4_ofs_iso_8859_8,                /* first non standard character */
+       cet_ucs4_cnt_iso_8859_8,                /* number of values in table    */
+
+       cet_ucs4_to_iso_8859_8_links,   /* UCS-4 to char links          */
+       cet_ucs4_to_iso_8859_8_ct,              /* number of links              */
+
+       NULL,                           /* hand made UCS-4 links        */
+       0,                              /* number of extra links        */
+
+       NULL    /* for internal use */
+};
+
+
+/*
+const int iso_8859_8_ucs4_full_map[] =
+{
+       0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 
+       0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 
+       0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 
+       0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 
+       0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 
+       0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 
+       0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 
+       0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 
+       0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 
+       0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 
+       0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 
+       0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 
+       0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 
+       0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 
+       0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 
+       0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f, 
+       0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 
+       0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, 
+       0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 
+       0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, 
+       0x00a0,     -1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, 
+       0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x203e, 
+       0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 
+       0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be,     -1, 
+           -1,     -1,     -1,     -1,     -1,     -1,     -1,     -1, 
+           -1,     -1,     -1,     -1,     -1,     -1,     -1,     -1, 
+           -1,     -1,     -1,     -1,     -1,     -1,     -1,     -1, 
+           -1,     -1,     -1,     -1,     -1,     -1,     -1, 0x2017, 
+       0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, 
+       0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, 
+       0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, 
+       0x05e8, 0x05e9, 0x05ea,     -1,     -1,     -1,     -1,     -1
+};
+*/
+
+#endif
index e357287e347d6677f370335848b379d7787cd023..256f93dc8a21f63c36f5c814e284ef2b3cc11170 100644 (file)
@@ -31,6 +31,7 @@
 #include "cet_util.h"
 
 #include <QtCore/QDebug>
+#include <QtCore/QTextCodec>
 
 #define MYNAME "cet_util"
 
@@ -50,6 +51,7 @@ static int cet_output = 0;
 
 #include "cet/ansi_x3_4_1968.h"
 #include "cet/cp1252.h"
+#include "cet/iso_8859_8.h"
 
 
 /* %%% short hand strings transmission for main character sets %%% */
@@ -193,6 +195,10 @@ cet_register(void)
 #ifdef cet_cs_name_cp1252
   cet_register_cs(&cet_cs_vec_cp1252);
 #endif
+#ifdef cet_cs_name_iso_8859_8
+  cet_register_cs(&cet_cs_vec_iso_8859_8);
+#endif
+
 
   if (cet_cs_vec_ct > 0) {
     cet_cs_vec_t* p;
@@ -344,6 +350,7 @@ cet_convert_deinit(void)
   }
   global_opts.charset = NULL;
   global_opts.charset_name = NULL;
+  global_opts.codec = NULL;
 }
 
 void
@@ -354,6 +361,14 @@ cet_convert_init(const char* cs_name, const int force)
     if (0 == cet_validate_cs(cs_name, &global_opts.charset, &global_opts.charset_name)) {
       fatal("Unsupported character set \"%s\"!\n", cs_name);
     }
+    if ((cs_name == NULL) || (strlen(cs_name) == 0)) { /* set default us-ascii */
+      global_opts.codec = QTextCodec::codecForName(CET_CHARSET_ASCII);
+    } else {
+      global_opts.codec = QTextCodec::codecForName(cs_name);
+    }
+    if (!global_opts.codec) {
+      fatal("Unsupported character set \"%s\"!\n", cs_name);
+    }
   }
 }
 
index 9fec3d2785aa97da9f9bfb68ca24db07b1ac49c3..d9d4988d2237ffcbc738848e56317509bdc4bcef 100644 (file)
 
 #include <QtCore/QString>
 #include <QtCore/QDebug>
+#include <QtCore/QTextCodec>
 #include <QtCore/QTextStream>
 
 # include "src/core/datetime.h"
 
 #define CSTR(qstr) (qstr.toUtf8().constData())
+#define STRFROMUNICODE(qstr) (global_opts.codec->fromUnicode(qstr).constData())
+#define STRTOUNICODE(cstr) (global_opts.codec->toUnicode(cstr))
 
 /*
  * Amazingly, this constant is not specified in the standard...
@@ -197,6 +200,7 @@ typedef struct {
   cet_cs_vec_t* charset;
   char* charset_name;
   inifile_t* inifile;
+  QTextCodec* codec;
 } global_options;
 
 extern global_options global_opts;
@@ -988,8 +992,8 @@ const char* get_filename(const char* fname);                        /* extract the filename portion *
 #define CET_NOT_CONVERTABLE_DEFAULT '$'
 #define CET_CHARSET_ASCII      "US-ASCII"
 #define CET_CHARSET_UTF8       "UTF-8"
-#define CET_CHARSET_HEBREW  "CP1255"
-#define CET_CHARSET_MS_ANSI    "MS-ANSI"
+#define CET_CHARSET_HEBREW  "ISO-8859-8"
+#define CET_CHARSET_MS_ANSI    "windows-1252"
 #define CET_CHARSET_LATIN1     "ISO-8859-1"
 
 #define str_utf8_to_cp1252(str) cet_str_utf8_to_cp1252((str))
index 253b8cf3245b4c09572eb95750559fb8f9940b01..1b6334f58b90e4d695242e05d257e173037eff54 100644 (file)
@@ -71,6 +71,7 @@
 
 static char* opt_cat, *opt_pos, *opt_notes, *opt_hide_bitmap, *opt_descr, *opt_bitmap;
 static char* opt_unique, *opt_alerts, *opt_units, *opt_speed, *opt_proximity, *opt_sleep;
+static char* opt_writecodec;
 static double defspeed, defproximity;
 static int alerts;
 
@@ -123,6 +124,10 @@ static arglist_t garmin_gpi_args[] = {
     "units", &opt_units, "Units used for names with @speed ('s'tatute or 'm'etric)",
     "m", ARGTYPE_STRING, ARG_NOMINMAX
   },
+  {
+    "writecodec", &opt_writecodec, "codec to use for writing strings",
+    "windows-1252", ARGTYPE_STRING, ARG_NOMINMAX
+  },
   ARG_TERMINATOR
 };
 
@@ -290,7 +295,7 @@ static QString
 gpi_read_string(const char* field)
 {
   char*s = gpi_read_string_old(field);
-  QString rv = QString::fromLatin1(s);
+  QString rv = STRTOUNICODE(s);
   xfree(s);
   return rv;
 }
@@ -731,7 +736,7 @@ write_string(const char* str, const char long_format)
 static void
 write_string(const QString& str, const char long_format)
 {
-  write_string(CSTR(str), long_format);
+  write_string(STRFROMUNICODE(str), long_format);
 }
 
 
@@ -1424,16 +1429,14 @@ load_bitmap_from_file(const char* fname, unsigned char** data, int* data_sz)
 static void
 garmin_gpi_rd_init(const char* fname)
 {
-  char cp[8];
-
   fin = gbfopen_le(fname, "rb", MYNAME);
   rdata = new reader_data_t;
 
   read_header();
 
   if ((codepage >= 1250) && (codepage <= 1257)) {
-    snprintf(cp, sizeof(cp), "CP%d", codepage);
-    cet_convert_init(cp, 1);
+    QString qCodecName = QString("windows-%1").arg(codepage);
+    cet_convert_init(CSTR(qCodecName), 1);
   } else {
     fatal(MYNAME ": Unsupported code page (%d). File is likely encrypted.\n", codepage);
   }
@@ -1448,8 +1451,6 @@ garmin_gpi_rd_init(const char* fname)
 static void
 garmin_gpi_wr_init(const char* fname)
 {
-  char cp[8];
-  cet_cs_vec_t* vec;
   int i;
 
   if (gpi_timestamp != 0) {                    /* not the first gpi output session */
@@ -1478,19 +1479,19 @@ garmin_gpi_wr_init(const char* fname)
   codepage = 0;
 
   for (i = 1250; i <= 1257; i++) {
-    snprintf(cp, sizeof(cp), "CP%d", i);
-    vec = cet_find_cs_by_name(cp);
-    if (vec == global_opts.charset) {
+    if (QString("windows-%1").arg(i).compare(QString(opt_writecodec), Qt::CaseInsensitive) == 0) {
       codepage = i;
       break;
     }
   }
 
   if (! codepage) {
-    warning(MYNAME ": Unsupported character set (%s)!\n", global_opts.charset_name);
-    fatal(MYNAME ": Valid values are CP1250 to CP1257.\n");
+    warning(MYNAME ": Unsupported character set (%s)!\n", opt_writecodec);
+    fatal(MYNAME ": Valid values are windows-1250 to windows-1257.\n");
   }
 
+  cet_convert_init(opt_writecodec,1);
+
   units = tolower(opt_units[0]);
   if ((units != 'm') && (units != 's')) {
     fatal(MYNAME ": Unknown units parameter (%c).\n", opt_units[0]);
index 9c3edaebde3d9e10fd2a25f84067ed941b5972c1..37152e953fe8de234adaf6711e73c531bea18a59 100644 (file)
@@ -715,7 +715,7 @@ static char igo2008_poi[] =
   "FIELD_DELIMITER             PIPE\n"
   "RECORD_DELIMITER    CRNEWLINE\n"
   "BADCHARS            \"|\n"
-  "ENCODING            MS-ANSI\n"
+  "ENCODING            windows-1252\n"
   "#\n"
   "# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:\n"
   "#\n"
@@ -1282,7 +1282,7 @@ static char tomtom_asc[] =
   "FIELD_DELIMITER             COMMA\n"
   "RECORD_DELIMITER    CRNEWLINE\n"
   "BADCHARS            ,\"\n"
-  "ENCODING            MS-ANSI\n"
+  "ENCODING            windows-1252\n"
   "#\n"
   "PROLOGUE     TomTom Navigator Places of Interest\n"
   "PROLOGUE     GPSBabel-__VERSION__ ASCII Export\n"
@@ -1311,7 +1311,7 @@ static char tomtom_itn[] =
   "FIELD_DELIMITER             PIPE\n"
   "RECORD_DELIMITER    CRNEWLINE\n"
   "BADCHARS            ,|\n"
-  "ENCODING            MS-ANSI\n"
+  "ENCODING            windows-1252\n"
   "#\n"
   "# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:\n"
   "#\n"
@@ -1336,7 +1336,7 @@ static char tomtom_itn_places[] =
   "FIELD_DELIMITER             PIPE\n"
   "RECORD_DELIMITER    CRNEWLINE\n"
   "BADCHARS            ,|\n"
-  "ENCODING            MS-ANSI\n"
+  "ENCODING            windows-1252\n"
   "#\n"
   "# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:\n"
   "#\n"
index c99c00b5c903d9c5bdd5341ea89e78195afcfe35..e10e2bfd65ef7204ad68a23514bb6a40378a1653 100644 (file)
@@ -26,7 +26,6 @@
 #include <ctype.h>
 #include <math.h>
 #include <QtCore/QDebug>
-#include <QtCore/QTextCodec>
 
 #define MYNAME        "Naviguide"
 
@@ -137,15 +136,10 @@ ng_fwrite_wp_data(const QString& s, const QString& d, ng_wp_data_t* wp_data, gbf
   int i;
   char z[50];
 
-  QTextCodec* codec = QTextCodec::codecForName("Hebrew");
-  if (!codec) {
-    fatal(MYNAME ": Unable to locate codec for Hebrew");
-  }
-
   memset(z, 0, 50);
   i = s.length();
   gbfwrite(&i, 1, 1, f);
-  gbfwrite(codec->fromUnicode(s).constData(), 1, i, f);
+  gbfwrite(STRFROMUNICODE(s), 1, i, f);
 
   gbfwrite(&wp_data->pad1[0], 8, 1, f);
   gbfputint32(wp_data->East, f);
@@ -155,7 +149,7 @@ ng_fwrite_wp_data(const QString& s, const QString& d, ng_wp_data_t* wp_data, gbf
 
   i = d.length();
   gbfwrite(&i, 1, 1, f);
-  gbfwrite(codec->fromUnicode(d).constData(), 1, i, f);
+  gbfwrite(STRFROMUNICODE(d), 1, i, f);
   gbfwrite(z, 44, 1, f);
 }
 
@@ -381,11 +375,6 @@ data_read(void)
     route_add_head(rte_head);
   }
 
-  QTextCodec* codec = QTextCodec::codecForName("Hebrew");
-  if (!codec) {
-    fatal(MYNAME ": Unable to locate codec for Hebrew");
-  }
-
   for (int n = 0; n < nof_wp; ++n) {
 
     Waypoint* wpt_tmp = new Waypoint;
@@ -413,8 +402,8 @@ data_read(void)
 
     /* put the data in the waypoint structure */
     ng_convert_datum(wpt_tmp);
-    wpt_tmp->shortname = codec->toUnicode(WPNC.strName);
-    wpt_tmp->description = codec->toUnicode(strComment);
+    wpt_tmp->shortname = STRTOUNICODE(WPNC.strName);
+    wpt_tmp->description = STRTOUNICODE(strComment);
 
     if (process_rte) {
       route_add_wpt(rte_head, wpt_tmp);
@@ -437,5 +426,5 @@ ff_vecs_t ng_vecs = {
   data_write,
   NULL,
   ng_args,
-  CET_CHARSET_ASCII, 0 // Hebrew, but explictly encoded.
+  CET_CHARSET_HEBREW, 0
 };
diff --git a/gpsbabel/reference/garmin_gpi_encoding.gpi b/gpsbabel/reference/garmin_gpi_encoding.gpi
new file mode 100644 (file)
index 0000000..4619677
Binary files /dev/null and b/gpsbabel/reference/garmin_gpi_encoding.gpi differ
diff --git a/gpsbabel/reference/garmin_gpi_encoding.gpx b/gpsbabel/reference/garmin_gpi_encoding.gpx
new file mode 100644 (file)
index 0000000..2e4d427
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gpx version="1.1" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/1">
+  <metadata>
+    <time>1970-01-01T00:00:00Z</time>
+    <bounds minlat="50.849999953" minlon="4.349999959" maxlat="50.849999953" maxlon="4.349999959"/>
+  </metadata>
+  <wpt lat="50.849999953" lon="4.349999959">
+    <name>€</name>
+    <cmt>™</cmt>
+    <desc>™</desc>
+    <sym>Waypoint</sym>
+  </wpt>
+</gpx>
diff --git a/gpsbabel/reference/garmin_gpi_encoding2.gpi.gpx b/gpsbabel/reference/garmin_gpi_encoding2.gpi.gpx
new file mode 100644 (file)
index 0000000..f2b1584
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gpx version="1.1" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/1">
+  <metadata>
+    <time>1970-01-01T00:00:00Z</time>
+    <bounds minlat="50.849999869" minlon="4.349999959" maxlat="50.849999869" maxlon="4.349999959"/>
+  </metadata>
+  <wpt lat="50.849999869" lon="4.349999959">
+    <name>€</name>
+    <cmt>™</cmt>
+    <desc>™</desc>
+    <sym>Waypoint</sym>
+  </wpt>
+</gpx>
index 477dc46a61369e0c3715e53920d219301cf50b12..9a1e6a34f7287447ecffdeba633f7c8487a0f86f 100644 (file)
@@ -13,7 +13,7 @@ DATATYPE              WAYPOINT
 FIELD_DELIMITER                PIPE
 RECORD_DELIMITER       CRNEWLINE
 BADCHARS               "|
-ENCODING               MS-ANSI
+ENCODING               windows-1252
 #
 # INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:
 #
index 022936a9f1db333d35da5fdde18e7daa881f24e3..e8e738ae36041dee5242a96b114ce75d2f3cc9dd 100644 (file)
@@ -13,7 +13,7 @@ DATATYPE              WAYPOINT
 FIELD_DELIMITER                COMMA
 RECORD_DELIMITER       CRNEWLINE
 BADCHARS               ,"
-ENCODING               MS-ANSI
+ENCODING               windows-1252
 #
 PROLOGUE        TomTom Navigator Places of Interest
 PROLOGUE        GPSBabel-__VERSION__ ASCII Export
index 2e1c9d93c9a34b69d0331e645db92360e66633c3..ec7b3975ee98a8f4a9fbed71e1b278bfcd300925 100644 (file)
@@ -13,7 +13,7 @@ DATATYPE              ROUTE
 FIELD_DELIMITER                PIPE
 RECORD_DELIMITER       CRNEWLINE
 BADCHARS               ,|
-ENCODING               MS-ANSI
+ENCODING               windows-1252
 #
 # INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:
 #
index 119afb803c21e881808e83847236fb97e6b9c399..106a16d099b1faf48e54edba939302c1ce69527e 100644 (file)
@@ -13,7 +13,7 @@ DATATYPE              ROUTE
 FIELD_DELIMITER                PIPE
 RECORD_DELIMITER       CRNEWLINE
 BADCHARS               ,|
-ENCODING               MS-ANSI
+ENCODING               windows-1252
 #
 # INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:
 #
index 8b9da3b5980826b1bbe62b496a42c8b5af0959a8..8f6fcaeeff2572ad02d775d82ef4566669749bc6 100644 (file)
@@ -20,3 +20,9 @@ compare ${REFERENCE}/gpi_ext-sample.csv ${TMPDIR}/gpi_ext-sample.csv
 gpsbabel -i garmin_gpi -f ${REFERENCE}/umsonstdraussen.gpi -o gpx,gpxver=1.1 -F ${TMPDIR}/umsonstdraussen.gpx
 compare ${REFERENCE}/umsonstdraussen.gpx ${TMPDIR}/umsonstdraussen.gpx
 
+# look for differnces between latin1 and windows-1252
+gpsbabel -i garmin_gpi -f ${REFERENCE}/garmin_gpi_encoding.gpi -o gpx,gpxver=1.1 -F ${TMPDIR}/garmin_gpi_encoding.gpx
+compare ${REFERENCE}/garmin_gpi_encoding.gpx ${TMPDIR}/garmin_gpi_encoding.gpx
+gpsbabel -i gpx -f ${REFERENCE}/garmin_gpi_encoding.gpx  -o garmin_gpi -F ${TMPDIR}/garmin_gpi_encoding.gpi
+gpsbabel -i garmin_gpi -f ${TMPDIR}/garmin_gpi_encoding.gpi -o gpx,gpxver=1.1 -F ${TMPDIR}/garmin_gpi_encoding2.gpi.gpx
+compare ${REFERENCE}/garmin_gpi_encoding2.gpi.gpx ${TMPDIR}/garmin_gpi_encoding2.gpi.gpx